#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<cstring>
#include<unordered_set>

using namespace std;

const int N = 10010;

int n, m;
int s[N], f[N];

int sg(int x)
{
    if (f[x] != -1)  return f[x];

    unordered_set<int> us;
    for (int i = 0; i < m; i++)
        if (x >= s[i])   us.insert(sg(x - s[i]));

    for (int i = 0;; i++)
        if (!us.count(i)) return f[x] = i;
}

int main()
{
    scanf("%d", &m);
    for (int i = 0; i < m; i++)  cin >> s[i];
    scanf("%d", &n);

    memset(f, -1, sizeof(f));
    int res = 0, t;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &t);
        res ^= sg(t);
    }

    if (res) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}